
import 'package:flutter/material.dart';
import 'package:rainflutter/pages/animation/tick_success_view.dart';


class PathAnimation extends StatefulWidget {
  @override
  _PathAnimationState createState() => _PathAnimationState();
}

class _PathAnimationState extends State<PathAnimation>
    with SingleTickerProviderStateMixin {
  AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(vsync: this);
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Loading"),
      ),
      body: Container(
        child: Column(
          children: [
            MaterialButton(
              color: Colors.blue,
              textColor: Colors.white,
              child: new Text('开始'),
              onPressed: _onClickStart,
            ),
            TickSuccessView(
              key: tickSuccessViewKey,
              size: Size(200, 100),
            ),
            Text("测试自定义组件的高度位置"),
          ],
        ),
      ),
    );
  }

  void _onClickStart() {
    //父组件中调用
    tickSuccessViewKey.currentState.startAnimation();
  }
}
